<?php
/*
Chương trình: "Quản lý Hóa Đơn và in hóa đơn Trường Thành"
Tác giả: "Lê Phương"
Phiên bản: "1.0"
Tệp tin: "add.tpl.php"
*/
if(defined("template")!=true)
{
	die('Template not found!');
}
?>
<html>
<head>
	<link rel="stylesheet" href="template/css/style.css" type="text/css">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script type="text/javascript">
	String.prototype.toProperCase = function() {
		var i, str, lowers, uppers;
		str = this.replace(/\w\S*/g, function(txt) {
			return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
		});
		lowers = ['A', 'An', 'The', 'And', 'But', 'Or', 'For', 'Nor', 'As', 'At', 
		'By', 'For', 'From', 'In', 'Into', 'Near', 'Of', 'On', 'Onto', 'To', 'With'];
		for (i = 0; i < lowers.length; i++)
			str = str.replace(new RegExp('\\s' + lowers[i] + '\\s', 'g'), 
				function(txt) {
					return txt.toLowerCase();
				});
		uppers = ['Id'];
		for (i = 0; i < uppers.length; i++)
			str = str.replace(new RegExp('\\b' + uppers[i] + '\\b', 'g'), 
				uppers[i].toUpperCase());

		return str;
	}
	</script> 
	<script language="JavaScript">
	Begin
	   var submitcount=0;
	   function checkSubmit() {

		  if (submitcount == 0)
		  {
		  submitcount++;
		  document.form1.submit();
		  }
	   }

	function textCounter(field, countfield, maxlimit) {
	  if (field.value.length > maxlimit)
		  {field.value = field.value.substring(0, maxlimit);}
		  else
		  {countfield.value = maxlimit - field.value.length;}
	  }
	</script>
</head>
<body>
	<form name="form1" method="GET" action="home.php?menu=add">
	<input type="hidden" name="id" value="<?=$edit?>">
	<table cellspacing="0" align="center" cellpadding="0" width="100%">
		<tr>
			<td width="100%">
				<table class="border" cellpadding="2" cellspacing="0" width="100%">
					<tr>
						<td colspan="3" class="title" align="center">
							<?=$phase['title_add_new_company']?>
						</td>
					</tr>
					<tr>
						<td class="fr" width="20%">
							<b><?=$phase['company_name']?></b>
						</td>
						<td width="1%" rowspan="5" class="fr_2">&nbsp;</td>
						<td width="79%" class="fr_2">
							<input type="text" name="name" size="70" onChange="javascript:this.value=this.value.toUpperCase();" value="<?=$name?>">
						</td>
					</tr>
					<tr>
						<td class="fr" width="20%">
							<b><?=$phase['tax_code']?></b>
						</td>
						<td class="fr_2">
							<input name="tax" type="text" value="<?=$tax?>" size="70"/>
						</td>
					</tr>
					<tr>
						<td class="fr" width="20%">
							<b><?=$phase['address']?></b>
						</td>
						<td class="fr_2">
							<input name="address" type="text" value="<?=$address?>" size="70"/>
						</td>
					</tr>
					<tr>
						<td class="fr" width="20%">
							<b><?=$phase['form']?></b>
						</td>
						<td class="fr_2">
							<input name="form" type="text" value="<?=$form?>" size="70"/>
						</td>
					</tr>
					<tr>
						<td class="fr" width="20%">
							<b><?=$phase['serial']?></b>
						</td>
						<td class="fr_2">
							<input name="serial" type="text" value="<?=$serial?>" size="70"/>
						</td>
					</tr>
					<tr>
						<td class="fr" colspan="3" align="center">
							<input type="submit" name="update" value="<?=$phase['update']?>" />
								&nbsp; 
							<input type="reset" name="Submit2" value="<?=$phase['reset']?>" />
						</td>
					</tr>
				</table>
				<div align="center"><strong><?=$warning?></strong></div>
		  </td>
		</tr>
	</table>
	</form>
</body>
</html>